package com.zjut.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zjut.domain.User;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
public interface UserServiceImpl {
    /**
     * 保存
     * @param user
     * @return
     */
    boolean save(User user);

    /**
     * 修改
     * @param user
     * @return
     */
    boolean update(User user);

    /**
     * 按id删除
     * @param id
     * @return
     */
    boolean delete(Integer id);

    /**
     * 按id查询
     * @param id
     * @return
     */
    User getById(Integer id);

    /**
     * 查询全部
     * @return
     */
    List<User> getAll();

    /**
     * 按username查询
     * @param username
     * @return
     */
    User getByUsername(String username);

    /**
     * 按username和password查询
     * @param username,password
     * @return
     */
    User getByUsernameAndPassword(String username,String password);

    /**
     * 分页
     * @return
     */
    IPage<User> getPage(Integer currentPage, Integer pageSize, User user);
}
